<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>库存预警</title>
<link rel="stylesheet" type="text/css" href="../css/default.css">
<link rel="stylesheet" type="text/css" href="../js/jquery-easyui-1.3.5/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="../js/jquery-easyui-1.3.5/themes/icon.css" />
<script type="text/javascript" src="../js/jquery-easyui-1.3.5/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../js/extends.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script>

$(function(){
	$("#tt").datagrid({
		height:$("#body").height()-$('#search_area').height()-5,
		width:$("#body").width(),
		idField:'userId',
		//data: data,
		url:"datagrid.json",  
		singleSelect:true, 
		nowrap:true,
		fitColumns:true,
		rownumbers:true,
		showPageList:false,
		selectOnCheck: true,
		checkOnSelect: true,
		columns:[[
			{field:'username',title:'资产编号：',width:100,halign:"center", align:"left"},
			{field:'name',title:'资产名称',width:100,halign:"center", align:"left"},
			{field:'sex',title:'资产库存',width:100,halign:"center", align:"left"},
			{field:'department',title:'盘点人',width:100,halign:"center", align:"left"}
		]],
		toolbar:'#tt_btn',  
        pagination:true,
		onDblClickRow:function(rowIndex, rowData){
			viewDetail(rowData.userId);
		}
	});
	
	$.getJSON("stock.json",function(data){
    $('#tt').datagrid("loadData",data);//将数据绑定到DataGrid中  
});
	//新增弹出框
	$("#save").on("click", function(){
		$parent("#parent_win").window({
			width:274,
			height:225,
			href:'user/addUser.html',
			title:'新增用户'
		});
	});
	//修改
	$("#update").on("click", function(){
		$parent.messager.alert("提示","update", "info");
	});
	//删除
	$("#delete").on("click", function(){
		$parent.messager.alert("提示","delete", "info");
	});
})

function viewDetail(date, id){
	$parent.messager.alert("提示","查询详细", "info");
}

//监听窗口大小变化
window.onresize = function(){
	setTimeout(domresize,300);
};
//改变表格宽高
function domresize(){
	$('#tt').datagrid('resize',{  
		height:$("#body").height()-$('#search_area').height()-5,
		width:$("#body").width()
	});
}
</script>
</head>
<body class="easyui-layout" >
<div id="body" region="center" > 
	 <!-- 查询条件区域 -->
  <div id="search_area" >
  	<table>
  		<tr>
  			<td>
  				<select>
  					<option>请选择要进行预警的资产</option>
  					<option>笔记本电脑</option>
  					<option>清扫车</option>
  					<option>办公桌</option>
  					<option>对讲机</option>
  					<option>复印机</option>
  					<option>工作服</option>
  				</select>
  			</td><td>
  				预警数量<input type="text" style="width: 30px;">
  			</td>
  			<td>
  				<button onclick="alert('设置成功！')">
  					设置
  				</button>
  			</td>
  		</tr>
  	</table>
  	</div>
    <div id="conditon">
  <!-- 数据表格区域 -->
  <table id="tt"></table>
  <!-- 表格顶部工具按钮 -->
  <div id="tt_btn">
  	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  </div>
</div>
</body>
</html>